importClass(Packages.org.framework2.utils.XMLReader);
importClass(Packages.org.framework2.utils.HttpClientUtil);
importClass(Packages.org.framework2.utils.DBTools);
importClass(Packages.org.framework2.utils.LogUtils);

LogUtils.initLogID();

//获取请求报文参数
var xmlData = request.getParameter('xmldata');
//解析XML数据
var xmlReader = new XMLReader(xmlData);
var transactionID = xmlReader.getNodeText('InnerBus.SvcCont.ProductDeployNotifyReq.TransactionID');
var enableID = xmlReader.getNodeText('InnerBus.SvcCont.ProductDeployNotifyReq.EnableID');
var action = xmlReader.getNodeText('InnerBus.SvcCont.ProductDeployNotifyReq.Action');
var cmpID = xmlReader.getNodeText('InnerBus.SvcCont.ProductDeployNotifyReq.CmpID');
var contentID = xmlReader.getNodeText('InnerBus.SvcCont.ProductDeployNotifyReq.ContentID');
var procID = xmlReader.getNodeText('InnerBus.ProcID');

var resourceIDs = new Array('000002','000008');

//响应CMS
var ret = '<?xml version="1.0" encoding="UTF-8"?>';
	  ret += '<InnerBus>';
    ret += '<Response>';
  	ret += '<RspCode>000000</RspCode>';
		ret += '<RspDesc>成功</RspDesc>';
		ret += '</Response>';
		ret += '</InnerBus>';
response.write(ret);

//回执CMS
var	retStr = '<?xml version="1.0" encoding="utf-8"?>';
		retStr += '<Cms>';
		retStr += '<SvcCont>';
		retStr += '<DeployReportReq>';
		retStr += '<EnableID>' + enableID + '</EnableID>';
		retStr += '<Action>' + action + '</Action>';
		retStr += '<TransactionID>' + transactionID + '</TransactionID>';
		
		var lastChar = transID.substring(transactionID.length - 1);
		if(lastChar == 9)
		{
			retStr += '<Result>1</Result>';
		}
		else
		{
			retStr += '<Result>0</Result>';
		}
		
		retStr += '<UrlItem>';
		for(var i = 0; i < resourceIDs.length; i++){
				retStr += '<RspURLItem>';
				retStr += '<ResourceID>' + resourceIDs[i] + '</ResourceID>';
				retStr += '<Result>0</Result>';
				retStr += '<Url></Url>';
				retStr += '<PreviewURL></PreviewURL>';
				retStr += '</RspURLItem>';
		}
		retStr += '</UrlItem>';
		retStr += '<CmpID>' + cmpID + '</CmpID>';
		retStr += '<ContentID>' + contentID +'</ContentID>';
		retStr += '</DeployReportReq>';
		retStr += '</SvcCont>';
		retStr += '<ProcID>a' + procID + '</ProcID>';
		retStr += '</Cms>';
		

var url = '/CMS4-DIST/ibus/confirmPortalForMusicController.do';
var map = new java.util.HashMap();
		map.put('xmldata',retStr);
println(retStr);
HttpClientUtil.post('http://10.25.102.143:5657' + url, 50000, map);
		
		
